package com.jiezheng.huinong.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import com.jiezheng.huinong.db.conf.ICommonInfoDAO;
import com.jiezheng.huinong.util.DbUtil;

public class CommonInfoDAOImpl implements ICommonInfoDAO {

	@Override
	public List<HashMap<String, String>> listBudgetUnitMap(String level,
			String parent) {

		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listBudgetUnitMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}
	
	@Override
	public List<HashMap<String, String>> listShiBoUnitMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listShiBoUnitMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listBudgetItemMap() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listBudgetItemMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listIndexSourceMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listIndexSourceMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listIndexTypeMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listIndexTypeMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listPayMethodMap() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listPayMethodMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFundPropMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFundPropMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFuncTypeMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;

		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFuncTypeMap", para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFinancialTypeMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		// 多值参数据的传递
		Map<String, String> para = new HashMap<String, String>();
		para.put("level", level);
		para.put("parent", parent);

		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFinancialTypeMap",
					para);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listSettleMethodMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listSettleMethodMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listBudgetTypeMap(String level,
			String parent) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listBudgetTypeMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listDeptMap() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listDeptMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listDeptBankMap() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session
					.selectList("com.jiezheng.huinong.commonInfo.listDeptBankMap");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listPostMap(String deptId) {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listPostMap", deptId);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listBudgetUnitNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listBudgetUnitNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listBudgetItemNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listBudgetItemNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listIndexSourceNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listIndexSourceNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listIndexTypeNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listIndexTypeNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listPayMethodNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listPayMethodNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFundPropNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFundPropNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFuncTypeNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFuncTypeNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listSettleMethodNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listSettleMethodNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listBudgetTypeNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listBudgetTypeNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

	@Override
	public List<HashMap<String, String>> listFinancialTypeNameId() {
		SqlSession session = DbUtil.getSqlSessionFactory().openSession();
		List<HashMap<String, String>> data = null;
		try {
			data = session.selectList(
					"com.jiezheng.huinong.commonInfo.listFinancialTypeNameId");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
		return data;
	}

}
